import type { LoginResult } from '@/types/member'
import { http } from '@/utils/http'

type LoginWxMinParams = {
  code: string
  encryptedData: string
  iv: string
  parentId: string
}

/**
 * 小程序登录
 * @param data
 * @returns
 */
export const postLoginWxMiniApi = (data: LoginWxMinParams) => {
  return http<LoginResult>({ method: 'POST', url: '/login/wxMini', data })
}

type LoginParams = {
  account: string
  password: string
}
/**
 * 传统登录-用户名+密码
 * @param data 请求参数
 */
export const postLoginNormalApi = (data: LoginParams) => {
  return http<LoginResult>({ method: 'POST', url: '/login/normal', data })
}
